<%@ page language="java" pageEncoding="utf-8"%>
<%@ taglib uri="http://struts.apache.org/tags-bean" prefix="bean" %>
<%@ taglib uri="http://struts.apache.org/tags-html" prefix="html" %>
<%@ taglib uri="http://struts.apache.org/tags-logic" prefix="logic" %>
<%@ taglib uri="http://struts.apache.org/tags-tiles" prefix="tiles" %>
<%@ taglib uri="http://ckeditor.com" prefix="ckeditor" %>
<%@page import="com.ckeditor.*,java.util.*,model.bo.Article;"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
  <jsp:include flush="true" page="_header.jsp"></jsp:include>
  <body class="bgwhite">
  	<logic:empty name="article">
  	没有查询到任何文章对象或系统异常，请联系管理员。
  	</logic:empty>
  	<logic:notEmpty name="article">
  		<div class="pannel">
  			<form name="frmcreatearticle" id="frmcreatearticle" method="post" action="admin.do?action=article&operate=update">
	  		<fieldset>
		  		<legend>发布文章</legend>
		  		<p>
		  			<label for="title">标题：</label>
		  		</p>
		  		<p>
		  			<input name="title" id="title" maxlength="28" size="50" class="txt" type="text" value="<bean:write name="article" property="articletitle" />" />
		  			<input name="id" type="hidden" value="<bean:write name="article" property="articleid" />" />
		  			<input name="typeid" type="hidden" value="<bean:write name="article" property="typeid" />" />
		  			<input name="author" type="hidden" value="<bean:write name="article" property="articleauthor" />" />
		  			<input name="fatherid" type="hidden" value="<bean:write name="article" property="fathertypeid" />" />
		  		</p>
		  		<logic:equal value="17" name="article" property="fathertypeid">
		  			<p>
			  			<label for="title">作者：</label>
			  		</p>
			  		<p>
			  			<input name="articleauthor2" id="articleauthor2" maxlength="28" size="50" class="txt" type="text" value="<bean:write name="article" property="articleauthor2" />" />
			  		</p>
		  		</logic:equal>
		  		<logic:notEqual value="17" name="article" property="fathertypeid">
		  			<input name="articleauthor2" type="hidden" value="" />
		  		</logic:notEqual>
		  		<p>
		  			<label for="content">文章内容：</label>
		  		</p>
		  		<p>
		  			<% 
				       Article obj = (Article)request.getAttribute("article");
						String value = obj.getArticlecontent();  //取得Object对象
		                Map<String, String> attr = new HashMap<String, String>();
		                CKEditorConfig settings = new CKEditorConfig();
		                settings.addConfigValue("toolbar","[['Source','-','Bold','Italic','Strike','-','RemoveFormat' ],['JustifyLeft','JustifyCenter','JustifyRight','JustifyBlock'],[ 'TextColor','BGColor' ], [ 'Find','Replace','-','SelectAll','-','Scayt' ],[ 'NumberedList','BulletedList','-','Outdent','Indent','-','Blockquote' ], [ 'Link','Unlink','Anchor' ], [ 'Image','HorizontalRule','PageBreak' ]]");
		                settings.addConfigValue("width", "90%");
		                settings.addConfigValue("height", "180px");
		                settings.addConfigValue("name","artcontent");
		                settings.addConfigValue("filebrowserUploadUrl","ckUpload.do?action=unspecified&type=file");
						settings.addConfigValue("filebrowserImageUploadUrl","ckUpload.do?action=unspecified&type=file");
						settings.addConfigValue("filebrowserFlashUploadUrl","ckUpload.do?type=Flash");
						//瀏览图片
						settings.addConfigValue("filebrowserImageBrowseUrl","browerServer.do?type=image");
					%>
					<ckeditor:editor textareaAttributes="<%=attr%>" basePath="./ckeditor/" config="<%=settings%>" editor="content" value="<%=value%>"/>  
		  		</p>
		  		<p>
		  			<input class="btn-submit" type="submit" value="确定" />
		  		</p>
		  	</fieldset>
		  	</form>
	  	</div>
  	</logic:notEmpty>
  </body>
</html>
